<?php
function teamid2leagueid($teamid, $HTClient) {
if ($teamid >= 52 && $teamid <= 6023) { return 1; }
if ($teamid >= 6024 && $teamid <= 6703) { return 7; }
if ($teamid >= 6704 && $teamid <= 7383) { return 3; }
if ($teamid >= 7384 && $teamid <= 8063) { return 2; }
if ($teamid >= 8064 && $teamid <= 8743) { return 8; }
if ($teamid >= 8744 && $teamid <= 8911) { return 6; }
if ($teamid >= 8912 && $teamid <= 9079) { return 5; }
if ($teamid >= 9080 && $teamid <= 9247) { return 4; }
if ($teamid >= 9248 && $teamid <= 17439) { return 1; }
if ($teamid >= 17440 && $teamid <= 20167) { return 11; }
if ($teamid >= 20168 && $teamid <= 20847) { return 9; }
if ($teamid >= 20848 && $teamid <= 21527) { return 14; }
if ($teamid >= 21528 && $teamid <= 22207) { return 12; }
if ($teamid >= 26840 && $teamid <= 27351) { return 6; }
if ($teamid >= 27352 && $teamid <= 27391) { return 29; }
if ($teamid >= 27392 && $teamid <= 27559) { return 28; }
if ($teamid >= 28072 && $teamid <= 28239) { return 32; }
if ($teamid >= 28240 && $teamid <= 28407) { return 31; }
if ($teamid >= 28408 && $teamid <= 28575) { return 30; }
if ($teamid >= 28576 && $teamid <= 28615) { return 27; }
if ($teamid >= 28616 && $teamid <= 28783) { return 26; }
if ($teamid >= 28784 && $teamid <= 28951) { return 35; }
if ($teamid >= 28952 && $teamid <= 29119) { return 15; }
if ($teamid >= 29120 && $teamid <= 29799) { return 16; }
if ($teamid >= 29800 && $teamid <= 29967) { return 17; }
if ($teamid >= 29968 && $teamid <= 30135) { return 18; }
if ($teamid >= 30136 && $teamid <= 30140) { return 34; }
if ($teamid >= 30141 && $teamid <= 30142) { return 59; }
if ($teamid >= 30143 && $teamid <= 30153) { return 34; }
if ($teamid >= 30154 && $teamid <= 30154) { return 59; }
if ($teamid >= 30155 && $teamid <= 30160) { return 34; }
if ($teamid >= 30161 && $teamid <= 30161) { return 59; }
if ($teamid >= 30162 && $teamid <= 30162) { return 34; }
if ($teamid >= 30163 && $teamid <= 30163) { return 59; }
if ($teamid >= 30164 && $teamid <= 30177) { return 34; }
if ($teamid >= 30178 && $teamid <= 30178) { return 59; }
if ($teamid >= 30179 && $teamid <= 30188) { return 34; }
if ($teamid >= 30189 && $teamid <= 30189) { return 59; }
if ($teamid >= 30190 && $teamid <= 30192) { return 34; }
if ($teamid >= 30193 && $teamid <= 30193) { return 59; }
if ($teamid >= 30194 && $teamid <= 30194) { return 34; }
if ($teamid >= 30195 && $teamid <= 30195) { return 59; }
if ($teamid >= 30196 && $teamid <= 30199) { return 34; }
if ($teamid >= 30200 && $teamid <= 30200) { return 59; }
if ($teamid >= 30201 && $teamid <= 30204) { return 34; }
if ($teamid >= 30205 && $teamid <= 30205) { return 59; }
if ($teamid >= 30206 && $teamid <= 30208) { return 34; }
if ($teamid >= 30209 && $teamid <= 30209) { return 59; }
if ($teamid >= 30210 && $teamid <= 30212) { return 34; }
if ($teamid >= 30213 && $teamid <= 30213) { return 59; }
if ($teamid >= 30214 && $teamid <= 30219) { return 34; }
if ($teamid >= 30220 && $teamid <= 30220) { return 59; }
if ($teamid >= 30221 && $teamid <= 30279) { return 34; }
if ($teamid >= 30280 && $teamid <= 30280) { return 59; }
if ($teamid >= 30281 && $teamid <= 30303) { return 34; }
if ($teamid >= 30304 && $teamid <= 30471) { return 19; }
if ($teamid >= 30472 && $teamid <= 30511) { return 33; }
if ($teamid >= 30512 && $teamid <= 31191) { return 36; }
if ($teamid >= 31192 && $teamid <= 31871) { return 20; }
if ($teamid >= 31872 && $teamid <= 32039) { return 21; }
if ($teamid >= 32040 && $teamid <= 32207) { return 22; }
if ($teamid >= 32208 && $teamid <= 32247) { return 23; }
if ($teamid >= 32248 && $teamid <= 32927) { return 24; }
if ($teamid >= 32928 && $teamid <= 33607) { return 25; }
if ($teamid >= 33608 && $teamid <= 34119) { return 31; }
if ($teamid >= 34120 && $teamid <= 36847) { return 37; }
if ($teamid >= 36888 && $teamid <= 36927) { return 38; }
if ($teamid >= 36928 && $teamid <= 36935) { return 39; }
if ($teamid >= 36936 && $teamid <= 36943) { return 46; }
if ($teamid >= 36976 && $teamid <= 36983) { return 47; }
if ($teamid >= 36992 && $teamid <= 36999) { return 45; }
if ($teamid >= 37000 && $teamid <= 37511) { return 15; }
if ($teamid >= 37512 && $teamid <= 37677) { return 47; }
if ($teamid >= 37678 && $teamid <= 37678) { return 60; }
if ($teamid >= 37679 && $teamid <= 38183) { return 47; }
if ($teamid >= 38184 && $teamid <= 38695) { return 32; }
if ($teamid >= 38696 && $teamid <= 46887) { return 1; }
if ($teamid >= 46888 && $teamid <= 47399) { return 5; }
if ($teamid >= 47400 && $teamid <= 49447) { return 36; }
if ($teamid >= 49448 && $teamid <= 52007) { return 4; }
if ($teamid >= 52008 && $teamid <= 54055) { return 3; }
if ($teamid >= 54056 && $teamid <= 64295) { return 2; }
if ($teamid >= 64296 && $teamid <= 66343) { return 9; }
if ($teamid >= 67497 && $teamid <= 67624) { return 38; }
if ($teamid >= 67625 && $teamid <= 68136) { return 26; }
if ($teamid >= 68137 && $teamid <= 70184) { return 14; }
if ($teamid >= 70185 && $teamid <= 72232) { return 8; }
if ($teamid >= 72233 && $teamid <= 72744) { return 17; }
if ($teamid >= 72745 && $teamid <= 72904) { return 46; }
if ($teamid >= 72905 && $teamid <= 73072) { return 44; }
if ($teamid >= 73073 && $teamid <= 73232) { return 45; }
if ($teamid >= 73233 && $teamid <= 73392) { return 39; }
if ($teamid >= 73393 && $teamid <= 73904) { return 21; }
if ($teamid >= 73905 && $teamid <= 75952) { return 12; }
if ($teamid >= 75953 && $teamid <= 78000) { return 15; }
if ($teamid >= 78001 && $teamid <= 78128) { return 27; }
if ($teamid >= 78129 && $teamid <= 78256) { return 33; }
if ($teamid >= 78257 && $teamid <= 80304) { return 24; }
if ($teamid >= 80305 && $teamid <= 80816) { return 39; }
if ($teamid >= 80817 && $teamid <= 81328) { return 44; }
if ($teamid >= 81329 && $teamid <= 91568) { return 25; }
if ($teamid >= 91569 && $teamid <= 93616) { return 16; }
if ($teamid >= 93617 && $teamid <= 93784) { return 52; }
if ($teamid >= 93785 && $teamid <= 93952) { return 51; }
if ($teamid >= 93953 && $teamid <= 94120) { return 50; }
if ($teamid >= 94121 && $teamid <= 94288) { return 56; }
if ($teamid >= 94289 && $teamid <= 94456) { return 58; }
if ($teamid >= 94457 && $teamid <= 94624) { return 54; }
if ($teamid >= 94625 && $teamid <= 94792) { return 55; }
if ($teamid >= 94793 && $teamid <= 94960) { return 53; }
if ($teamid >= 94961 && $teamid <= 95128) { return 57; }
if ($teamid >= 95129 && $teamid <= 95640) { return 56; }
if ($teamid >= 95641 && $teamid <= 96152) { return 51; }
if ($teamid >= 96153 && $teamid <= 96664) { return 46; }
if ($teamid >= 96665 && $teamid <= 104856) { return 1; }
if ($teamid >= 104857 && $teamid <= 106904) { return 44; }
if ($teamid >= 106905 && $teamid <= 108952) { return 17; }
if ($teamid >= 108953 && $teamid <= 111000) { return 7; }
if ($teamid >= 111001 && $teamid <= 111128) { return 29; }
if ($teamid >= 111129 && $teamid <= 111256) { return 23; }
if ($teamid >= 111257 && $teamid <= 111262) { return 34; }
if ($teamid >= 111263 && $teamid <= 111272) { return 59; }
if ($teamid >= 111273 && $teamid <= 111278) { return 34; }
if ($teamid >= 111279 && $teamid <= 111281) { return 59; }
if ($teamid >= 111282 && $teamid <= 111283) { return 34; }
if ($teamid >= 111284 && $teamid <= 111285) { return 59; }
if ($teamid >= 111286 && $teamid <= 111286) { return 34; }
if ($teamid >= 111287 && $teamid <= 111424) { return 59; }
if ($teamid >= 111439 && $teamid <= 111440) { return 60; }
if ($teamid >= 111441 && $teamid <= 111441) { return 47; }
if ($teamid >= 111442 && $teamid <= 111606) { return 60; }
if ($teamid >= 111607 && $teamid <= 112118) { return 34; }
if ($teamid >= 112119 && $teamid <= 112630) { return 59; }
if ($teamid >= 112631 && $teamid <= 112798) { return 63; }
if ($teamid >= 112799 && $teamid <= 113310) { return 54; }
if ($teamid >= 113311 && $teamid <= 113822) { return 50; }
if ($teamid >= 113823 && $teamid <= 115870) { return 56; }
if ($teamid >= 115871 && $teamid <= 116382) { return 52; }
if ($teamid >= 116383 && $teamid <= 116894) { return 53; }
if ($teamid >= 116895 && $teamid <= 117062) { return 64; }
if ($teamid >= 117063 && $teamid <= 117230) { return 62; }
if ($teamid >= 117231 && $teamid <= 117742) { return 58; }
if ($teamid >= 117743 && $teamid <= 125934) { return 36; }
if ($teamid >= 125935 && $teamid <= 134126) { return 3; }
if ($teamid >= 134127 && $teamid <= 136174) { return 46; }
if ($teamid >= 136175 && $teamid <= 136342) { return 61; }
if ($teamid >= 136343 && $teamid <= 138390) { return 47; }
if ($teamid >= 138391 && $teamid <= 138902) { return 45; }
if ($teamid >= 138903 && $teamid <= 140950) { return 31; }
if ($teamid >= 140951 && $teamid <= 142998) { return 39; }
if ($teamid >= 142999 && $teamid <= 151190) { return 14; }
if ($teamid >= 151191 && $teamid <= 151702) { return 38; }
if ($teamid >= 151743 && $teamid <= 154302) { return 63; }
if ($teamid >= 154303 && $teamid <= 154814) { return 64; }
if ($teamid >= 154815 && $teamid <= 155326) { return 62; }
if ($teamid >= 155327 && $teamid <= 157374) { return 58; }
if ($teamid >= 157375 && $teamid <= 159422) { return 51; }
if ($teamid >= 159423 && $teamid <= 167614) { return 9; }
if ($teamid >= 167615 && $teamid <= 175806) { return 46; }
if ($teamid >= 175807 && $teamid <= 177854) { return 5; }
if ($teamid >= 177855 && $teamid <= 178366) { return 61; }
if ($teamid >= 178367 && $teamid <= 178878) { return 35; }
if ($teamid >= 178879 && $teamid <= 187070) { return 37; }
if ($teamid >= 187071 && $teamid <= 195262) { return 44; }
if ($teamid >= 195263 && $teamid <= 203454) { return 11; }
if ($teamid >= 203455 && $teamid <= 205502) { return 6; }
if ($teamid >= 205503 && $teamid <= 213694) { return 14; }
if ($teamid >= 213695 && $teamid <= 221886) { return 7; }
if ($teamid >= 221887 && $teamid <= 230078) { return 8; }
if ($teamid >= 230079 && $teamid <= 230590) { return 18; }
if ($teamid >= 230591 && $teamid <= 230758) { return 70; }
if ($teamid >= 230759 && $teamid <= 232806) { return 53; }
if ($teamid >= 232807 && $teamid <= 240998) { return 4; }
if ($teamid >= 240999 && $teamid <= 241166) { return 69; }
if ($teamid >= 241167 && $teamid <= 241334) { return 66; }
if ($teamid >= 241335 && $teamid <= 241502) { return 67; }
if ($teamid >= 241503 && $teamid <= 243550) { return 26; }
if ($teamid >= 243551 && $teamid <= 251742) { return 46; }
if ($teamid >= 251743 && $teamid <= 259934) { return 12; }
if ($teamid >= 259935 && $teamid <= 260102) { return 71; }
if ($teamid >= 260103 && $teamid <= 268294) { return 24; }
if ($teamid >= 268295 && $teamid <= 268462) { return 68; }
if ($teamid >= 268463 && $teamid <= 268974) { return 28; }
if ($teamid >= 268975 && $teamid <= 269486) { return 23; }
if ($teamid >= 269487 && $teamid <= 269998) { return 19; }
if ($teamid >= 269999 && $teamid <= 272046) { return 18; }
if ($teamid >= 272047 && $teamid <= 272558) { return 29; }
if ($teamid >= 272687 && $teamid <= 273198) { return 66; }
if ($teamid >= 273199 && $teamid <= 273710) { return 57; }
if ($teamid >= 273711 && $teamid <= 275758) { return 28; }
if ($teamid >= 275759 && $teamid <= 277806) { return 19; }
if ($teamid >= 277807 && $teamid <= 279854) { return 50; }
if ($teamid >= 279855 && $teamid <= 281902) { return 21; }
if ($teamid >= 281911 && $teamid <= 281918) { return 74; }
if ($teamid >= 281919 && $teamid <= 282118) { return 73; }
if ($teamid >= 282119 && $teamid <= 282150) { return 74; }
if ($teamid >= 282151 && $teamid <= 282158) { return 77; }
if ($teamid >= 282159 && $teamid <= 282166) { return 76; }
if ($teamid >= 282167 && $teamid <= 282206) { return 75; }
if ($teamid >= 282207 && $teamid <= 282238) { return 76; }
if ($teamid >= 282239 && $teamid <= 282270) { return 77; }
if ($teamid >= 282271 && $teamid <= 282398) { return 73; }
if ($teamid >= 282399 && $teamid <= 282526) { return 74; }
if ($teamid >= 282527 && $teamid <= 282654) { return 75; }
if ($teamid >= 282655 && $teamid <= 282782) { return 76; }
if ($teamid >= 282783 && $teamid <= 282910) { return 77; }
if ($teamid >= 282911 && $teamid <= 291102) { return 18; }
if ($teamid >= 291103 && $teamid <= 299294) { return 5; }
if ($teamid >= 299295 && $teamid <= 307486) { return 39; }
if ($teamid >= 307487 && $teamid <= 315678) { return 36; }
if ($teamid >= 315679 && $teamid <= 323870) { return 44; }
if ($teamid >= 323871 && $teamid <= 332062) { return 7; }
if ($teamid >= 332063 && $teamid <= 340254) { return 3; }
if ($teamid >= 340255 && $teamid <= 340430) { return 72; }
if ($teamid >= 340431 && $teamid <= 348622) { return 63; }
if ($teamid >= 359503 && $teamid <= 367694) { return 14; }
if ($teamid >= 392823 && $teamid <= 393334) { return 74; }
if ($teamid >= 393335 && $teamid <= 393846) { return 69; }
if ($teamid >= 393847 && $teamid <= 394358) { return 76; }
if ($teamid >= 394359 && $teamid <= 394526) { return 79; }
if ($teamid >= 394527 && $teamid <= 396574) { return 32; }
if ($teamid >= 396575 && $teamid <= 398622) { return 23; }
if ($teamid >= 398623 && $teamid <= 400670) { return 45; }
if ($teamid >= 400671 && $teamid <= 408862) { return 11; }
if ($teamid >= 408863 && $teamid <= 417054) { return 56; }
if ($teamid >= 417055 && $teamid <= 425246) { return 15; }
if ($teamid >= 425247 && $teamid <= 433438) { return 16; }
if ($teamid >= 433439 && $teamid <= 433606) { return 80; }
if ($teamid >= 433607 && $teamid <= 441798) { return 36; }
if ($teamid >= 441799 && $teamid <= 449990) { return 7; }
if ($teamid >= 449991 && $teamid <= 458182) { return 1; }
if ($teamid >= 458223 && $teamid <= 458230) { return 81; }
if ($teamid >= 458231 && $teamid <= 458238) { return 83; }
if ($teamid >= 458239 && $teamid <= 458270) { return 81; }
if ($teamid >= 458271 && $teamid <= 458302) { return 83; }
if ($teamid >= 458303 && $teamid <= 458430) { return 81; }
if ($teamid >= 458431 && $teamid <= 458558) { return 83; }
if ($teamid >= 458559 && $teamid <= 460606) { return 29; }
if ($teamid >= 460607 && $teamid <= 462654) { return 54; }
if ($teamid >= 462655 && $teamid <= 462662) { return 84; }
if ($teamid >= 462663 && $teamid <= 463174) { return 33; }
if ($teamid >= 463175 && $teamid <= 463334) { return 84; }
if ($teamid >= 463335 && $teamid <= 463502) { return 85; }
if ($teamid >= 463503 && $teamid <= 463670) { return 88; }
if ($teamid >= 463671 && $teamid <= 463838) { return 89; }
if ($teamid >= 463839 && $teamid <= 472030) { return 46; }
if ($teamid >= 472031 && $teamid <= 480222) { return 24; }
if ($teamid >= 480223 && $teamid <= 482270) { return 52; }
if ($teamid >= 482271 && $teamid <= 484318) { return 66; }
if ($teamid >= 484359 && $teamid <= 484366) { return 91; }
if ($teamid >= 484367 && $teamid <= 484374) { return 97; }
if ($teamid >= 484375 && $teamid <= 484382) { return 94; }
if ($teamid >= 484383 && $teamid <= 484390) { return 95; }
if ($teamid >= 484391 && $teamid <= 484398) { return 93; }
if ($teamid >= 484399 && $teamid <= 484406) { return 96; }
if ($teamid >= 484407 && $teamid <= 484438) { return 91; }
if ($teamid >= 484439 && $teamid <= 484470) { return 97; }
if ($teamid >= 484471 && $teamid <= 484502) { return 94; }
if ($teamid >= 484503 && $teamid <= 484534) { return 95; }
if ($teamid >= 484535 && $teamid <= 484566) { return 93; }
if ($teamid >= 484567 && $teamid <= 484726) { return 96; }
if ($teamid >= 484727 && $teamid <= 484854) { return 93; }
if ($teamid >= 484855 && $teamid <= 484982) { return 95; }
if ($teamid >= 484983 && $teamid <= 485110) { return 94; }
if ($teamid >= 485111 && $teamid <= 485238) { return 91; }
if ($teamid >= 485239 && $teamid <= 485366) { return 97; }
if ($teamid >= 485367 && $teamid <= 493558) { return 36; }
if ($teamid >= 493559 && $teamid <= 501750) { return 7; }
if ($teamid >= 501751 && $teamid <= 509942) { return 14; }
if ($teamid >= 509943 && $teamid <= 518134) { return 44; }
if ($teamid >= 518135 && $teamid <= 526326) { return 3; }
if ($teamid >= 526327 && $teamid <= 526838) { return 67; }
if ($teamid >= 526839 && $teamid <= 527350) { return 22; }
if ($teamid >= 527351 && $teamid <= 527862) { return 68; }
if ($teamid >= 527863 && $teamid <= 529910) { return 64; }
if ($teamid >= 529911 && $teamid <= 531958) { return 62; }
if ($teamid >= 531959 && $teamid <= 534006) { return 74; }
if ($teamid >= 534007 && $teamid <= 536054) { return 69; }
if ($teamid >= 536055 && $teamid <= 544246) { return 19; }
if ($teamid >= 544247 && $teamid <= 552438) { return 4; }
if ($teamid >= 552439 && $teamid <= 552950) { return 27; }
if ($teamid >= 552951 && $teamid <= 561142) { return 12; }
if ($teamid >= 561143 && $teamid <= 569334) { return 25; }
if ($teamid >= 569335 && $teamid <= 577526) { return 11; }
if ($teamid >= 577527 && $teamid <= 585718) { return 51; }
if ($teamid >= 585719 && $teamid <= 593910) { return 5; }
if ($teamid >= 612983 && $teamid <= 613494) { return 72; }
if ($teamid >= 613495 && $teamid <= 614006) { return 81; }
if ($teamid >= 614007 && $teamid <= 614518) { return 70; }
if ($teamid >= 614519 && $teamid <= 615030) { return 96; }
if ($teamid >= 615031 && $teamid <= 617078) { return 35; }
if ($teamid >= 617079 && $teamid <= 619126) { return 57; }
if ($teamid >= 619127 && $teamid <= 627318) { return 6; }
if ($teamid >= 627319 && $teamid <= 635510) { return 46; }
if ($teamid >= 635511 && $teamid <= 643702) { return 28; }
if ($teamid >= 643703 && $teamid <= 651894) { return 3; }
if ($teamid >= 651895 && $teamid <= 660086) { return 32; }
if ($teamid >= 660087 && $teamid <= 668278) { return 62; }
if ($teamid >= 668279 && $teamid <= 676470) { return 66; }
if ($teamid >= 676471 && $teamid <= 684662) { return 53; }
if ($teamid >= 684663 && $teamid <= 692854) { return 23; }
if ($teamid >= 692855 && $teamid <= 701046) { return 37; }
if ($teamid >= 701047 && $teamid <= 709238) { return 18; }
if ($teamid >= 709239 && $teamid <= 709246) { return 100; }
if ($teamid >= 709247 && $teamid <= 709254) { return 99; }
if ($teamid >= 709255 && $teamid <= 709262) { return 101; }
if ($teamid >= 709263 && $teamid <= 709270) { return 103; }
if ($teamid >= 709271 && $teamid <= 709302) { return 100; }
if ($teamid >= 709303 && $teamid <= 709334) { return 99; }
if ($teamid >= 709335 && $teamid <= 709366) { return 101; }
if ($teamid >= 709367 && $teamid <= 709398) { return 103; }
if ($teamid >= 709399 && $teamid <= 709526) { return 99; }
if ($teamid >= 709527 && $teamid <= 709654) { return 100; }
if ($teamid >= 709655 && $teamid <= 709782) { return 103; }
if ($teamid >= 709783 && $teamid <= 709910) { return 101; }
if ($teamid >= 709911 && $teamid <= 709918) { return 98; }
if ($teamid >= 709919 && $teamid <= 709958) { return 102; }
if ($teamid >= 709959 && $teamid <= 710118) { return 98; }
if ($teamid >= 710119 && $teamid <= 710246) { return 102; }
if ($teamid >= 710247 && $teamid <= 710254) { return 104; }
if ($teamid >= 710271 && $teamid <= 710278) { return 105; }
if ($teamid >= 710279 && $teamid <= 710310) { return 104; }
if ($teamid >= 710311 && $teamid <= 710318) { return 106; }
if ($teamid >= 710319 && $teamid <= 710350) { return 105; }
if ($teamid >= 710351 && $teamid <= 710510) { return 106; }
if ($teamid >= 710511 && $teamid <= 710638) { return 105; }
if ($teamid >= 710639 && $teamid <= 710766) { return 104; }
if ($teamid >= 710767 && $teamid <= 710934) { return 107; }
if ($teamid >= 710935 && $teamid <= 711446) { return 93; }
if ($teamid >= 711447 && $teamid <= 713494) { return 67; }
if ($teamid >= 713495 && $teamid <= 714006) { return 101; }
if ($teamid >= 714007 && $teamid <= 714518) { return 55; }
if ($teamid >= 714519 && $teamid <= 722710) { return 16; }
if ($teamid >= 722711 && $teamid <= 730902) { return 4; }
if ($teamid >= 730903 && $teamid <= 739094) { return 25; }
if ($teamid >= 739095 && $teamid <= 747286) { return 44; }
if ($teamid >= 747287 && $teamid <= 755478) { return 46; }
if ($teamid >= 755479 && $teamid <= 763670) { return 1; }
if ($teamid >= 763671 && $teamid <= 771862) { return 14; }
if ($teamid >= 771863 && $teamid <= 780054) { return 36; }
if ($teamid >= 780055 && $teamid <= 788246) { return 12; }
if ($teamid >= 788247 && $teamid <= 788758) { return 30; }
if ($teamid >= 788759 && $teamid <= 790806) { return 34; }
if ($teamid >= 790807 && $teamid <= 791318) { return 60; }
if ($teamid >= 791319 && $teamid <= 793366) { return 59; }
if ($teamid >= 793367 && $teamid <= 793534) { return 110; }
if ($teamid >= 793535 && $teamid <= 793702) { return 111; }
if ($teamid >= 793703 && $teamid <= 793870) { return 112; }
if ($teamid >= 793871 && $teamid <= 794038) { return 113; }
if ($teamid >= 794039 && $teamid <= 802230) { return 36; }
if ($teamid >= 802231 && $teamid <= 810422) { return 46; }
if ($teamid >= 810423 && $teamid <= 818614) { return 14; }
if ($teamid >= 818615 && $teamid <= 826806) { return 3; }
if ($teamid >= 826807 && $teamid <= 834998) { return 7; }
if ($teamid >= 834999 && $teamid <= 843190) { return 44; }
if ($teamid >= 850067 && $teamid <= 858258) { return 4; }
if ($teamid >= 858259 && $teamid <= 866450) { return 25; }
if ($teamid >= 866451 && $teamid <= 874642) { return 24; }
if ($teamid >= 874643 && $teamid <= 882834) { return 37; }
if ($teamid >= 882835 && $teamid <= 891026) { return 58; }
if ($teamid >= 891027 && $teamid <= 899218) { return 52; }
if ($teamid >= 899219 && $teamid <= 907410) { return 50; }
if ($teamid >= 907411 && $teamid <= 915602) { return 29; }
if ($teamid >= 915603 && $teamid <= 923794) { return 34; }
if ($teamid >= 923795 && $teamid <= 924306) { return 91; }
if ($teamid >= 924307 && $teamid <= 924818) { return 84; }
if ($teamid >= 924819 && $teamid <= 925330) { return 89; }
if ($teamid >= 925331 && $teamid <= 925842) { return 97; }
if ($teamid >= 925843 && $teamid <= 934034) { return 11; }
if ($teamid >= 934035 && $teamid <= 936082) { return 60; }
if ($teamid >= 936083 && $teamid <= 936594) { return 103; }
if ($teamid >= 936595 && $teamid <= 937106) { return 73; }
if ($teamid >= 937107 && $teamid <= 939154) { return 96; }
if ($teamid >= 939155 && $teamid <= 941202) { return 22; }
if ($teamid >= 941203 && $teamid <= 943250) { return 30; }
if ($teamid >= 943251 && $teamid <= 951442) { return 74; }
if ($teamid >= 951443 && $teamid <= 959634) { return 2; }
if ($teamid >= 959635 && $teamid <= 967826) { return 5; }
if ($teamid >= 967827 && $teamid <= 976018) { return 18; }
if ($teamid >= 976019 && $teamid <= 984210) { return 3; }
if ($teamid >= 984211 && $teamid <= 986258) { return 68; }
if ($teamid >= 986259 && $teamid <= 986426) { return 117; }
if ($teamid >= 986427 && $teamid <= 986594) { return 118; }
if ($teamid >= 986595 && $teamid <= 986762) { return 119; }
if ($teamid >= 986763 && $teamid <= 986930) { return 120; }
if ($teamid >= 986931 && $teamid <= 986938) { return 121; }
if ($teamid >= 986939 && $teamid <= 986946) { return 122; }
if ($teamid >= 986947 && $teamid <= 986978) { return 121; }
if ($teamid >= 986979 && $teamid <= 987010) { return 122; }
if ($teamid >= 987011 && $teamid <= 987138) { return 121; }
if ($teamid >= 987139 && $teamid <= 987266) { return 122; }
if ($teamid >= 987267 && $teamid <= 987434) { return 123; }
if ($teamid >= 987435 && $teamid <= 987442) { return 124; }
if ($teamid >= 987443 && $teamid <= 987450) { return 125; }
if ($teamid >= 987451 && $teamid <= 987458) { return 126; }
if ($teamid >= 987459 && $teamid <= 987490) { return 124; }
if ($teamid >= 987491 && $teamid <= 987522) { return 125; }
if ($teamid >= 987523 && $teamid <= 987554) { return 126; }
if ($teamid >= 987555 && $teamid <= 987682) { return 124; }
if ($teamid >= 987683 && $teamid <= 987810) { return 125; }
if ($teamid >= 987811 && $teamid <= 987938) { return 126; }
if ($teamid >= 987939 && $teamid <= 996130) { return 36; }
if ($teamid >= 996131 && $teamid <= 1004322) { return 3; }
if ($teamid >= 1004323 && $teamid <= 1012514) { return 14; }
if ($teamid >= 1012515 && $teamid <= 1020706) { return 46; }
if ($teamid >= 1020707 && $teamid <= 1028898) { return 44; }
if ($teamid >= 1028899 && $teamid <= 1037090) { return 7; }
if ($teamid >= 1037091 && $teamid <= 1045282) { return 4; }
if ($teamid >= 1045283 && $teamid <= 1053474) { return 24; }
if ($teamid >= 1053475 && $teamid <= 1061666) { return 12; }
if ($teamid >= 1061667 && $teamid <= 1069858) { return 37; }
if ($teamid >= 1069859 && $teamid <= 1078050) { return 9; }
if ($teamid >= 1078051 && $teamid <= 1086242) { return 32; }
if ($teamid >= 1086243 && $teamid <= 1094434) { return 63; }
if ($teamid >= 1094435 && $teamid <= 1102626) { return 19; }
if ($teamid >= 1102627 && $teamid <= 1110818) { return 57; }
if ($teamid >= 1110819 && $teamid <= 1119010) { return 64; }
if ($teamid >= 1119011 && $teamid <= 1127202) { return 67; }
if ($teamid >= 1127204 && $teamid <= 1135394) { return 1; }
if ($teamid >= 1135395 && $teamid <= 1143586) { return 3; }
if ($teamid >= 1143590 && $teamid <= 1151778) { return 1; }
if ($teamid >= 1151780 && $teamid <= 1159970) { return 3; }
if ($teamid >= 1159971 && $teamid <= 1168162) { return 5; }
if ($teamid >= 1168163 && $teamid <= 1176354) { return 4; }
if ($teamid >= 1176355 && $teamid <= 1184546) { return 11; }
if ($teamid >= 1184549 && $teamid <= 1192738) { return 37; }
if ($teamid >= 1192743 && $teamid <= 1200930) { return 3; }
if ($teamid >= 1200938 && $teamid <= 1217314) { return 7; }
if ($teamid >= 1217315 && $teamid <= 1225506) { return 12; }
if ($teamid >= 1225507 && $teamid <= 1233698) { return 14; }
if ($teamid >= 1233699 && $teamid <= 1241890) { return 18; }
if ($teamid >= 1241895 && $teamid <= 1250082) { return 3; }
if ($teamid >= 1274660 && $teamid <= 1282850) { return 14; }
if ($teamid >= 1282855 && $teamid <= 1291042) { return 3; }
if ($teamid >= 1291047 && $teamid <= 1299234) { return 14; }
if ($teamid >= 1299235 && $teamid <= 1307426) { return 24; }
if ($teamid >= 1315623 && $teamid <= 1323810) { return 14; }
if ($teamid >= 1323811 && $teamid <= 1332002) { return 24; }
if ($teamid >= 1332004 && $teamid <= 1340194) { return 36; }
if ($teamid >= 1356582 && $teamid <= 1364770) { return 14; }
if ($teamid >= 1364771 && $teamid <= 1372962) { return 36; }
if ($teamid >= 1381156 && $teamid <= 1389346) { return 46; }
if ($teamid >= 1405731 && $teamid <= 1413922) { return 25; }
if ($teamid >= 1413923 && $teamid <= 1422114) { return 36; }
if ($teamid >= 1422115 && $teamid <= 1430306) { return 25; }
if ($teamid >= 1430307 && $teamid <= 1438498) { return 36; }
if ($teamid >= 1446691 && $teamid <= 1454882) { return 46; }
if ($teamid >= 1454883 && $teamid <= 1463074) { return 36; }
if ($teamid >= 1465962 && $teamid <= 1471266) { return 44; }
if ($teamid >= 1471271 && $teamid <= 1495842) { return 46; }
if ($teamid >= 1495843 && $teamid <= 1504034) { return 11; }
if ($teamid >= 1512227 && $teamid <= 1520418) { return 12; }
if ($teamid >= 1520419 && $teamid <= 1528610) { return 4; }
if ($teamid >= 1536805 && $teamid <= 1544994) { return 44; }
if ($teamid >= 1577765 && $teamid <= 1602338) { return 36; }
if ($teamid >= 1602339 && $teamid <= 1602378) { return 127; }
if ($teamid >= 1602379 && $teamid <= 1602546) { return 128; }
if ($teamid >= 1610739 && $teamid <= 1610906) { return 129; }
if ($teamid >= 1610907 && $teamid <= 1619098) { return 69; }
if ($teamid >= 1619099 && $teamid <= 1627290) { return 23; }
if ($teamid >= 1627291 && $teamid <= 1629338) { return 61; }
if ($teamid >= 1629339 && $teamid <= 1629850) { return 107; }
if ($teamid >= 1629851 && $teamid <= 1630362) { return 85; }
if ($teamid >= 1630363 && $teamid <= 1630874) { return 117; }
if ($teamid >= 1630875 && $teamid <= 1632922) { return 101; }
if ($teamid >= 1632923 && $teamid <= 1634970) { return 72; }
if ($teamid >= 1634971 && $teamid <= 1643162) { return 16; }
if ($teamid >= 1643163 && $teamid <= 1651354) { return 51; }
if ($teamid >= 1651355 && $teamid <= 1659546) { return 39; }
if ($teamid >= 1659547 && $teamid <= 1667738) { return 16; }
if ($teamid >= 1667739 && $teamid <= 1668250) { return 77; }
if ($teamid >= 1668251 && $teamid <= 1668762) { return 98; }
if ($teamid >= 1668763 && $teamid <= 1668890) { return 127; }
if ($teamid >= 1668891 && $teamid <= 1670938) { return 76; }
if ($teamid >= 1670939 && $teamid <= 1679130) { return 17; }
if ($teamid >= 1679131 && $teamid <= 1679306) { return 130; }
if ($teamid >= 1679307 && $teamid <= 1679474) { return 131; }
if ($teamid >= 1679475 && $teamid <= 1679642) { return 132; }
if ($teamid >= 1679643 && $teamid <= 1687834) { return 52; }
if ($teamid >= 1687835 && $teamid <= 1696026) { return 4; }
if ($teamid >= 1704219 && $teamid <= 1720602) { return 32; }
if ($teamid >= 1720603 && $teamid <= 1736986) { return 4; }
if ($teamid >= 1736987 && $teamid <= 1737498) { return 131; }
if ($teamid >= 1737499 && $teamid <= 1745690) { return 35; }
if ($teamid >= 1745691 && $teamid <= 1747738) { return 89; }
if ($teamid >= 1747739 && $teamid <= 1749786) { return 97; }
if ($teamid >= 1749787 && $teamid <= 1766170) { return 5; }
if ($teamid >= 1798939 && $teamid <= 1799138) { return 133; }
if ($teamid >= 1799139 && $teamid <= 1799306) { return 134; }

//not found, look up manually
$teamdetails = $HTClient->getTeam($teamid);
return $teamdetails['leagueid'];
}

?>
